/**
 * 
 */
package components.IOBuffer;

import java.util.Arrays;

import javax.swing.JTextArea;

/**
 * @author Chz
 * 
 */
public class OutputBuffer extends IOBuffer {

	int[] buffer;
	private int endBit = 0;
	JTextArea console;

	public OutputBuffer(JTextArea jta) {
		buffer = new int[BUFFERLEN];
		console = jta;
	}

	/***
	 * do nothing special but set endBit into 0 and return null.
	 */
	@Override
	public int[] flush() {
		console.append("\n");
		// buffer = new int[] { 0 };
		return null;
	}

	/***
	 * put something into buffer, then immediately flushed out into GUI text
	 * area.
	 */
	@Override
	public void putIntoBuffer(int i) {

		console.append((char) i + "");

	}

	// public static void main(String[] args) {
	// OutputBuffer ib = new OutputBuffer(null);
	// for (int i = 0; i < 20; i++)
	// ib.putIntoBuffer((char) i);
	//
	// }

}
